<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ArenacontestUser extends Model
{
    public function user()
    {
        return $this->belongsTo('App\Models\WechatUser','user_id','id');
    }

    public function arenacontest()
    {
        return $this->belongsTo('App\Models\Arenacontest','arenacontest_id','id');
    }

    public static function  getstatus($status = null)
    {
        $arr = [
            10 => "等待审核",
            20 => "确定参赛",
        ];
        if ($status !== null) {
            return array_key_exists($status, $arr) ? $arr[$status] : $arr['0'];
        }
        return $arr;
    }

    public static function getpayStatus($status = null)
    {
        $arr = [
            10 => "待缴费",
            20 => "已缴费",
            30 => "已退费",
        ];
        if ($status !== null) {
            return array_key_exists($status, $arr) ? $arr[$status] : $arr['0'];
        }
        return $arr;
    }

    public static function getRefundState($status = null)
    {
        $arr = [
            1 => "退款申请中",
            2 => "已拒绝",
            3 => "退款中",
            4 => "已退款",
        ];
        if ($status !== null) {
            return array_key_exists($status, $arr) ? $arr[$status] : $arr['0'];
        }
        return $arr;
    }

    public function cityInfo()
    {
        return $this->belongsTo('App\Models\CityList', 'city', 'key');
    }
}
